{include file="public/header" /}
<style type="text/css">
    .center_th{text-align: center!important;}
</style>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.ds_pintuan_commend}</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    <!--   拼团商品列表  -->
    <div class="layui-form-item">
        <table class="layui-table">
            <thead>
            <tr>
                <th class="center_th">供应商名</th>
                <th class="center_th">拼团商品名</th>
                <th class="center_th">拼团开始时间</th>
                <th class="center_th">拼团结束时间</th>
                <th class="center_th">拼团状态</th>
                <th class="center_th">是否是推荐展位</th>
            </tr>
            </thead>
            <tbody style="text-align: center;">
            {notempty name="pintuan_list"}
            {foreach name="pintuan_list" item="v"}
            <tr class="hover edit">
                <td>{$v.store_name}</td>
                <td>{$v.pintuan_goods_name}</td>
                <td>{:date("Y-m-d H:i:s",$v.pintuan_starttime)}</td>
                <td>{:date("Y-m-d H:i:s",$v.pintuan_end_time)}</td>
                <td>
                    {if $v['pintuan_state'] == 1} 正常 {/if}
                    {if $v['pintuan_state'] == 0} 取消 {/if}
                </td>
                {if $v['is_commend'] == 0}
                <td>
                    <input flag="{$v['pintuan_id']}" class="commend" type="checkbox" name="is_commend">
                </td>
                {/if}
                {if $v['is_commend'] == 1}
                <td>
                    <input flag="{$v['pintuan_id']}" class="commend" type="checkbox" name="is_commend" checked="true">
                </td>
                {/if}
            </tr>
            {/foreach}
            {/notempty}
            </tbody>
        </table>
    </div>
</div>
<link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui-v2.5.5/css/layui.css" />
<script src="https://www.layuicdn.com/layui-v2.5.5/layui.js"></script>
<script type="text/javascript">
    $('.commend').click(function () {
        var openStatus = 1;

        if($(this).is(":checked") == false) openStatus = 0;
        var pintuanId = $(this).attr('flag');
        $.post(
            "{:url('Pintuan/setCommend')}",
            {pintuanId:pintuanId,openStatus:openStatus},
            function (res) {
                layer.msg(res.msg);
                location.reload();
            }
        );
    });
</script>